package jpsearchcore;

import java.util.List;

import javax.xml.bind.JAXBElement;

public class Person {
	private String GivenName = "";
	private String FamilyName = "";
	
	public Person(){}
	
	public Person(String givenName, String familyName){
		GivenName = givenName;
		FamilyName = familyName;
	}
	
	public Person(PersonNameType p){
		List<JAXBElement<String>> fullname = p.getGivenNameOrFamilyName();	
		if(fullname.size() > 0){
			int i;
			for(i=0; i<fullname.size()-1; i++){
				GivenName += fullname.get(0).getValue();
				
				if(i+1 < fullname.size()-1){
					GivenName += " ";
				}
			}
			FamilyName = fullname.get(i).getValue();	
		}
	}
	
	public String getGivenName(){
		return GivenName;
	}
	
	public String getFamilyName(){
		return FamilyName;
	}
		
	public void setGivenName(String givenName) {
		GivenName = givenName;
	}

	public void setFamilyName(String familyName) {
		FamilyName = familyName;
	}

	public String toString(){
		return getGivenName() + " " + getFamilyName();
	}
}
